
#ifndef	__FECAB_STORE_SERVICE_HPP_2010__
#define	__FECAB_STORE_SERVICE_HPP_2010__

#include <string>

#include "sancab/packet.pb.h"
#include "sancab/store.hpp"
#include "service.hpp"

namespace	sancab	{
namespace	server	{

class	StoreService
		:	public Service
{
public	:
	StoreService( const std::string config_file );
	virtual	~StoreService();

public	:
	virtual	int	handle( const std::string& request, std::string& response );

public	:
	virtual	int	slim( void );

private	:
	int		handlePUT( sancab::Packet& pkt_request, sancab::Packet& pkt_response );
	int		handleAPPEND( sancab::Packet& pkt_request, sancab::Packet& pkt_response );
	int		handlePUTIGNORE( sancab::Packet& pkt_request, sancab::Packet& pkt_response );
	int		handleGET( sancab::Packet& pkt_request, sancab::Packet& pkt_response );
	int		handleDELETE( sancab::Packet& pkt_request, sancab::Packet& pkt_response );

	int		handleMAPPEND( sancab::Packet& pkt_request, sancab::Packet& pkt_response );

private	:
	std::string	_config_filename;

	sancab::StoreManager		_store_manager;
	sancab::Store*	_store_p;
};

}	// namespace server
}	// namespace sancab

#endif	//	__FECAB_STORE_SERVICE_HPP_2010__

